#!/bin/bash

# 确保脚本运行时能获取到正确的当前目录
cd "$(dirname "$0")"

# 拉取最新的git更改
git pull

# 生成一个12到29之间的随机数
count=$((RANDOM % 18 + 12))
echo "total: $count"

# 循环count次
for ((i=1; i<=$count; i++)); do
    # 写入index.js文件
    echo "var a = $i" > index.js
    
    # 添加并提交改动
    git add .
    git commit -m 'Great'
    echo "index: $i"
done

# 推送到远程仓库
git push

# 打印成功信息
echo "*----------------SUCCESS--------------------*"
echo "*                                           *"
echo "*                a commit a day             *"
echo "*         keeps your girlfriend away        *"
echo "*                                           *"
echo "*-----------------SUCCESS-------------------*"